﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace VidoopSecure
{
    /// <summary>
    /// Base class for all Vidoop Secure services.
    /// </summary>
    public class Service
    {
        private VSManager _manager;
        private string _apiBase;
        private Site _site;

        /// <summary>
        /// Vidoop Secure Manager that created this service.
        /// </summary>
        public VSManager Manager 
        { 
            get { return _manager; } 
            set { _manager = value; } 
        }

        /// <summary>
        /// Base Url to use for Vidoop Secure API.
        /// </summary>
        public string ApiBase 
        { 
            get { return _apiBase; } 
            set { _apiBase = value; } 
        }

        /// <summary>
        /// Vidoop Secure site for this service.
        /// </summary>
        public Site Site 
        { 
            get { return _site; } 
            set { _site = value; } 
        } 

    
        /// <summary>
        /// Create an instance of a <see cref="VidoopSecure.Service" />.
        /// </summary>
        /// <remarks>This class is typically used as a base for specific
        /// service classes.</remarks>
        /// <param name="manager">The <see cref="VidoopSecure.VSManager /> used
        /// to perform operations with this service.</param>
        /// <param name="site">The <see cref="VidoopSecure.Site" /> associated with
        /// this service.</param>
        /// <param name="apiBase">The base URL to be used for accessing services.</param>
        public Service(VSManager manager, Site site, string apiBase)
        {
            Manager = manager;
            Site = site;
            ApiBase = apiBase;
        }

        /// <summary>
        /// Creates a VidoopSecure url. 
        /// </summary>
        /// <param name="partialUrl">The portion of the URL that will follow the base.</param>
        /// <returns>A complete VidoopSecure url.</returns>
        public string CreateRequestUrl(string partialUrl)
        {
            return this.ApiBase + partialUrl;
        }

    }
}
